{extend name="PublicBase/showBase" /}

{block name="body"}
<div class="main">
    <div class="row">
        <div class="col-md-12">
            <section class="tile color transparent-black">
                <div class="tile-header bg-transparent-black-2">
                    <h1>
                        {if condition="$Info eq ''"}
                            {:lang('WxPzXz')}
                        {else /}
                            {:lang('WxPzGx')}
                        {/if}
                    </h1>
                    <div class="controls">
                        <a href="javascript:void(0);" onclick="window.history.back();"><i class="fa fa-arrow-left"></i></a>
                        {if condition="$Info eq ''"}
                            <a href="{:url('WechatConfs/showAdd')}"><i class="fa fa-refresh"></i></a>
                        {else /}
                            <a href="{:url('WechatConfs/showEdit', array('id'=>$Info['config_id']))}"><i class="fa fa-refresh"></i></a>
                        {/if}
                    </div>
                </div>
                <div class="tile-body nopadding">
                    <form class="FormTable" action="" method="post">
                        <div class="tile-body">
                            <div class="row">
                                <div class="form-group col-sm-12">
                                    <label>{:lang('WxPzFz')}</label>
                                    <select class="chosen-select chosen-transparent form-control" name="config_group">
                                        {volist name="Group" id="vo"}
                                            <option value="{$vo.content_value}" {eq name="Info['config_group']" value="$vo['content_value']"}selected{/eq}>{$vo.content_name}</option>
                                        {/volist}
                                    </select>
                                </div>
                                <div class="form-group col-sm-12">
                                    <label>{:lang('WxPzBs')}</label>
                                    <input type="text" class="form-control required" name="config_name" value="{$Info.config_name}" placeholder="{:lang('WxPzBsWk')}{:lang('WxPzBsAl')}">
                                </div>
                                <div class="form-group col-sm-12">
                                    <label>{:lang('WxPzMc')}</label>
                                    <input type="text" class="form-control required" name="config_title" value="{$Info.config_title}" placeholder="{:lang('WxPzMcWk')}">
                                </div>
                                <div class="form-group col-sm-12">
                                    <label>{:lang('WxPzLx')}</label>
                                    <select class="chosen-select chosen-transparent form-control" name="config_type" id="config_type">
                                        <option value="1" {eq name="Info['config_type']" value="1"}selected{/eq}>{:lang('WxPzLx1')}</option>
                                        <option value="2" {eq name="Info['config_type']" value="2"}selected{/eq}>{:lang('WxPzLx2')}</option>
                                    </select>
                                </div>
                                <div class="form-group col-sm-12" id="div_input">
                                    <label>{:lang('WxPzNr')}</label>
                                    <input type="text" class="form-control" name="config_value" value="{$Info.config_value}" id="wechat_input" placeholder="{:lang('WxPzNrWk')}">
                                </div>
                                <div class="form-group col-sm-12" id="div_select" style="display:none">
                                    <label>{:lang('WxPzXl')}</label>
                                    <input type="text" class="form-control" name="config_select" value="{$Info.config_select}" id="wechat_select" placeholder="{:lang('WxPzXlWk')}{:lang('WxPzXlAl')}">
                                </div>
                                <div class="form-group col-sm-12">
                                    <label>{:lang('WxPzSm')}</label>
                                    <input type="text" class="form-control" name="config_remark" value="{$Info.config_remark}" placeholder="{:lang('WxPzSmWk')}">
                                </div>
                                <div class="form-group col-sm-12">
                                    <label>{:lang('WxPzXs')}</label>
                                    <select class="chosen-select chosen-transparent form-control" name="config_show">
                                        <option value="2" {eq name="Info['config_show']" value="2"}selected{/eq}>{:lang('WxPzXs2')}</option>
                                        <option value="1" {eq name="Info['config_show']" value="1"}selected{/eq}>{:lang('WxPzXs1')}</option>
                                    </select>
                                </div>
                                <div class="form-group col-sm-12">
                                    <label>{:lang('WxPzPx')}</label>
                                    <input type="text" class="form-control" name="wechat_sort" value="{$Info.config_sort|default=0}" placeholder="{:lang('WxPzPxWk')}{:lang('WxPzPxAl')}">
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="tile-footer bg-transparent-black-2 rounded-bottom-corners">
                    <div class="row">
                        <div class="col-sm-12 text-center">
                            <button type="button" class="btn btn-{:config('CNF_BTNCOLOR')} ajax-post">{:lang('XtAnTj')}</button>
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </div>
</div>
{/block}

{block name="script"}
    <script>
        $(function(){
            {if condition="$Info['config_type'] eq 1"}
                $('#div_input').show();
                $('#div_select').hide();
            {elseif condition="$Info['config_type'] eq 2" /}
                $('#div_input,#div_select').show();
            {/if}

            $('#wechat_type').change(function(){
                $('#wechat_input,#wechat_select').val('');
                var wechat_type = $('#wechat_type').val();
                if(wechat_type == 1){
                    $('#div_input').show();
                    $('#div_select').hide();
                }else if(wechat_type == 2){
                    $('#div_input,#div_select').show();
                }
            });
        })
    </script>
{/block}
      
